package com.ruge.user.controller;

import com.ruge.core.response.Response;
import com.ruge.user.domain.request.BlobFollowRequest;
import com.ruge.user.service.BlobFollowService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author ruge.wu
 * @since 2021/12/27 16:45
 */
@Slf4j
@RestController
@Api(tags = "【微博 关注 相关接口】", value = "【微博 关注 相关接口】")
@RequestMapping("blog/follow")
public class BlobFollowController {

    @Resource
    private BlobFollowService blobFollowService;


    @PostMapping("follow")
    @ApiOperation(value = "【微博】  关注")
    public Response follow(@RequestBody BlobFollowRequest request) {
        return blobFollowService.follow(request);
    }


    @GetMapping("getMyFollow")
    @ApiOperation(value = "【微博】  查询我的关注（查看我的关注列表）")
    public Response getMyFollow(@ApiParam(value = "我的id") @RequestParam("aid") Long aid) {
        return blobFollowService.getMyFollow(aid);
    }

    @GetMapping("getMyFans")
    @ApiOperation(value = "【微博】  查看我的粉丝列表")
    public Response getMyFans(@ApiParam(value = "我的id") @RequestParam("aid") Long aid) {
        return blobFollowService.getMyFans(aid);
    }


    @GetMapping("getCommonFollow")
    @ApiOperation(value = "【微博】  共同关注 （返回我和博主的共同关注）", notes = "计算两个id的交集")
    public Response getCommonFollow(BlobFollowRequest request) {
        return blobFollowService.getCommonFollow(request);
    }

    @GetMapping("getMyFollowTransFollow")
    @ApiOperation(value = "【微博】  查询我关注的人也关注他")
    public Response getMyFollowTransFollow(BlobFollowRequest request) {
        return blobFollowService.getMyFollowTransFollow(request);
    }

    @GetMapping("getMyMayKnowPerson")
    @ApiOperation(value = "【微博】  我可能认识的人", notes = "sdiff rugeSet xuruiSet")
    public Response getMyMayKnowPerson(@ApiParam(value = "我的id") @RequestParam("aid") Long aid) {
        return blobFollowService.getMyMayKnowPerson(aid);
    }

}
